home *** CD-ROM | disk | FTP | other *** search
- ;****** thxplay.library/--overview-- ******************************************
- ;
- ; PURPOSE
- ; To provide an interface to the THX2 player.
- ;
- ; OVERVIEW
- ; THX2 is a 'chip' music tracker by Martin Wodok (Dexter/Abyss). It
- ; comes with a rather cumbersome binary replayer, so you may play THX2
- ; songs in your own programs. This provides an easy and powerful
- ; interface to the THX2 player, providing a wide range of functions.
- ;
- ; - Allocation: thxInit(), thxFree()
- ; - Playing: thxPlay(), thxStop(), thxPause(), thxWind()
- ; - Volume: thxGetVolume(), thxSetVolume()
- ; - Multisong: thxGetNumSongs(), thxSetSong()
- ; - Sound FX: thxPlayNote(), thxStopNote(), thxNoteFX()
- ; - Misc: thxSignalEnd(), thxSongEnded(), thxSyncByte(),
- ; thxPlaytime()
- ;
- ; You need to read a THX song in from disk or 'incbin' it. You should
- ; load it into PUBLIC memory, however it does not have to be CHIP
- ; memory.
- ;
- ; The music play is, as you would expect, interrupt-driven, and
- ; asynchronous. This interface automatically provides fallback support
- ; for a VSYNC based replayer if it cannot allocate a CIA timer.
- ;
- ; The interface is 68000 compatible, optimised versions for the 68020
- ; and better are also included. The interface is available as an Amiga
- ; E module, a shared library, or a C link-library.
- ;
- ; NOTE
- ; This interface was initially developed as an Amiga E module. With a
- ; little extra effort, it is also available as a runtime shared
- ; library. Therefore, it operates a simple mechanism in thxInit() and
- ; thxFree() to ensure only one task at any time is using the library.
- ; See the notes of thxInit() for more information about this.
- ;
- ; Also note that all examples are given in Amiga E code.
- ;
- ; Synopsis is given as 3 lines: the assembler/register synopsis, the C
- ; prototype, and the E synopsis.
- ;
- ; EXAMPLE
- ; More thorough examples are included with the distribution.
- ; This is an example in Amiga E, using the E module thx-play.m.
- ;
- ; MODULE 'tools/thx-play', 'tools/file'
- ; PROC main()
- ; DEF mod
- ; IF mod := loadfile(arg, 0, MEMF_PUBLIC)
- ; IF thxInit(mod)=0
- ; thxPlay()
- ; REPEAT; WaitTOF(); UNTIL CtrlC() OR thxSongEnded()
- ; thxStop()
- ;
- ; thxFree()
- ; ENDIF
- ; freefile(mod)
- ; ENDIF
- ; ENDPROC
- ;
- ; Here is the same example, but using the shared thxplay.library.
- ; Note that Amiga E forces library functions to have capitalised
- ; names, and that we must use OpenLibrary() and CloseLibrary().
- ;
- ; MODULE 'thxplay', 'tools/file'
- ; PROC main()
- ; DEF mod
- ; IF thxplaybase := OpenLibrary('thxplay.library', 5)
- ; IF mod := loadfile(arg, 0, MEMF_PUBLIC)
- ; IF ThxInit(mod) = 0
- ; ThxPlay()
- ; REPEAT; WaitTOF(); UNTIL CtrlC() OR ThxSongEnded()
- ; ThxStop()
- ;
- ; ThxFree()
- ; ENDIF
- ; freefile(mod)
- ; ENDIF
- ; CloseLibrary(thxplaybase)
- ; ENDIF
- ; ENDPROC
- ;
- ;
- ;****************************************************************************
- ;
- ;
- incdir include:
- include exec/execbase.i
- include exec/initializers.i
- include exec/libraries.i
- include exec/lists.i
- include exec/memory.i
- include exec/nodes.i
- include exec/resident.i
- include exec/semaphores.i
- include exec/types.i
- include hardware/intbits.i
- include lvo/exec_lib.i
-
- incdir ""
- ifd LIBRARY
- include thxplay.library_rev.i
- include library.asm
- endc
-
- include misc.asm
- include note.asm
- include multisong.asm
- include volume.asm
- include song.asm
- include init.asm
- include interrupt.asm
-
- include bin/thx-offsets.i
- ifd USE020
- THX incbin bin/thx-replayer020.bin
- else
- THX incbin bin/thx-replayer000.bin
- endc
-
- ifd ENAMES
- xdef thxInit__i
- xdef thxFree
- thxInit__i=thxInit
-
- xdef thxPlaytime
- xdef thxSyncByte
- xdef thxSignalEnd__ii
- thxSignalEnd__ii=thxSignalEnd
-
- xdef thxGetNumSongs
- xdef thxSetSong__i
- thxSetSong__i=thxSetSong
-
- xdef thxPlayNote__iii
- xdef thxNoteFX__iii
- xdef thxStopNote__i
- thxPlayNote__iii=thxPlayNote
- thxNoteFX__iii=thxNoteFX
- thxStopNote__i=thxStopNote
-
- xdef thxPlay
- xdef thxPause
- xdef thxStop
- xdef thxWind__i
- thxWind__i=thxWind
-
- xdef thxGetVolume
- xdef thxSetVolume__i
- thxSetVolume__i=thxSetVolume
- endc
-
-
- ifd CNAMES
- xdef _thxInit
- xdef _thxFree
-
- xdef _thxPlaytime
- xdef _thxSyncByte
- xdef _thxSignalEnd
-
- xdef _thxGetNumSongs
- xdef _thxSetSong
-
- xdef _thxPlayNote
- xdef _thxNoteFX
- xdef _thxStopNote
-
- xdef _thxPlay
- xdef _thxPause
- xdef _thxStop
- xdef _thxWind
-
- xdef _thxGetVolume
- xdef _thxSetVolume
-
- _thxInit=thxInit
- _thxFree=thxFree
-
- _thxPlaytime=thxPlaytime
- _thxSyncByte=thxSyncByte
- _thxSignalEnd=thxSignalEnd
-
- _thxGetNumSongs=thxGetNumSongs
- _thxSetSong=thxSetSong
-
- _thxPlayNote=thxPlayNote
- _thxNoteFX=thxNoteFX
- _thxStopNote=thxStopNote
-
- _thxPlay=thxPlay
- _thxPause=thxPause
- _thxStop=thxStop
- _thxWind=thxWind
-
- _thxGetVolume=thxGetVolume
- _thxSetVolume=thxSetVolume
- endc
-